package com.jmb.apiplatform.exception;


import com.jmb.apiplatform.common.Result;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.RestControllerAdvice;

@RestControllerAdvice
public class GlobalExceptionHandler {
    @ExceptionHandler(ValidException.class)
    public Result handleValidException(ValidException validException){
        return Result.fail(validException.getMessage());
    }
    @ExceptionHandler(LoginException.class)
    public Result LoginException(LoginException loginException){
        return Result.failCode(loginException.getMessage());
    }
    @ExceptionHandler(BusinessException.class)
    public Result handleBusinessException(BusinessException businessException){
        return Result.failCode(businessException.getMessage());
    }
}
